<?PHP
/**
 * LianPHP主程序
 * 
 * @author 大春 dachun.net
 * @version 1.0 2010 11 15
 * @copyright Copyright &copy; 2010 lian wan chun
 */

include_once("conf/init.php");

class LianPhp{

	protected static $_conf;
	protected static $_db;
	protected static $_expand;
	protected static $_core;

	/**
	 * 框架配置信息
	 */
	public static function conf(){
		if(self::$_conf===NULL){
			if (!defined('G_PATH_SYS')) define('G_PATH_SYS',dirname(__FILE__)."/");
			if (!defined('G_URL_SYS')) define('G_URL_SYS',dirname($_SERVER['PHP_SELF'])."/");
			include_once("core/LianConfig.class.php");
			self::$_conf = new LianConfig;
		}
		return self::$_conf;
	}

	/**
	 * 数据库工厂类
	 */
	public static function db($DB_type="mysql"){
		if(self::$_db===NULL){
			include_once("db/Database.class.php");
			$db = new Database;
			self::$_db = $db->factory($DB_type);
		}
		return self::$_db;
	}

	/**
	 * 框架扩展类库
	 */
	public static function expand(){
		if(self::$_expand===NULL){
			include_once("expand/ExpandInterface.class.php");
			self::$_expand = new ExpandInterface;
		}
		return self::$_expand;
	}

	/**
	 * 框架核心类库
	 */
	public static function core(){
		if(self::$_core===NULL){
			include_once("core/CoreInterface.class.php");
			self::$_core = new CoreInterface;
		}
		return self::$_core;
	}
}
?>